#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>


int main()
{
	/*int* p = (int*)malloc(5 * sizeof(int));
	if (p == NULL)
	{
		perror("malloc");
		return 1;
	}
	for (int i = 0;i < 5;i++)
	{
		printf("%d\n", *(p + i));
	}


	free(p);
	p = NULL;*/

	/*int* p = (int*)calloc(5 , sizeof(int));
	if (p == NULL)
	{
		perror("calloc");
		return 1;
	}
	for (int i = 0;i < 5;i++)
	{
		printf("%d\n", *(p + i));
	}


	free(p);
	p = NULL;*/
	int* p = (int*)calloc(5, sizeof(int));
	if (p == NULL)
	{
		perror("calloc");
		return 1;
	}
	int* p0 = realloc(p, 10 * sizeof(int));
	if (p0 == NULL)
	{
		perror("realloc");
		free(p);
		p = NULL;
		return 1;
	}
	p = p0;
	for (int i = 0;i < 10;i++)
	{
		printf("%d\n", *(p + i));
	}


	free(p);
	p = NULL;


	return 0;
}

